package com.bootlever.framework.redis.cfg;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;

public class BootLeverJedisPoolConfig {

    private static final boolean DEFAULT_AUTO_CONFIGURATION = true;

    private boolean autoconfiguration = DEFAULT_AUTO_CONFIGURATION;

    private GenericObjectPoolConfig pool = new GenericObjectPoolConfig();
    private Cluster cluster = new Cluster();
    private Sentinel sentinel = new Sentinel();

    public boolean isAutoconfiguration() {
        return autoconfiguration;
    }

    public void setAutoconfiguration(boolean autoconfiguration) {
        this.autoconfiguration = autoconfiguration;
    }

    public GenericObjectPoolConfig getPool() {
        return pool;
    }

    public void setPool(GenericObjectPoolConfig pool) {
        this.pool = pool;
    }

    public Cluster getCluster() {
        return cluster;
    }

    public void setCluster(Cluster cluster) {
        this.cluster = cluster;
    }

    public Sentinel getSentinel() {
        return sentinel;
    }

    public void setSentinel(Sentinel sentinel) {
        this.sentinel = sentinel;
    }

    public static class Sentinel{

    }

    public static class Cluster{
        private Integer connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
        private Integer soTimeout = DEFAULT_SO_TIMEOUT;
        private Integer maxAttempts = DEFAULT_MAX_ATTEMPTS;

        private static final int DEFAULT_CONNECTION_TIMEOUT = 2000;
        private static final int DEFAULT_SO_TIMEOUT = 100;
        private static final int DEFAULT_MAX_ATTEMPTS = 5;

        public Integer getConnectionTimeout() {
            return connectionTimeout;
        }

        public void setConnectionTimeout(Integer connectionTimeout) {
            this.connectionTimeout = connectionTimeout;
        }

        public Integer getSoTimeout() {
            return soTimeout;
        }

        public void setSoTimeout(Integer soTimeout) {
            this.soTimeout = soTimeout;
        }

        public Integer getMaxAttempts() {
            return maxAttempts;
        }

        public void setMaxAttempts(Integer maxAttempts) {
            this.maxAttempts = maxAttempts;
        }
    }
}
